<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Grocer.Master" CodeBehind="ProductList.aspx.cs" Inherits="EasyGrocer.UI.ProductList" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="head">
</asp:Content>
    
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="MainContent">
    <center><asp:Label ID="Label1" runat="server" CssClass="mainTitle" Text="Search For Items"></asp:Label></center>

    <asp:ListView ID="ProductView" runat="server" >
        <ItemTemplate>
            <tr style="background-color:#DCDCDC;color: #000000;">
                <td>
                    <a href="<%#"ProductDetails.aspx?id="+ Eval("ID")%>" ><asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></a>
                </td>
                <td>
                    <asp:Label ID="AisleLabel" runat="server" Text='<%# Eval("Aisle") %>' />
                </td>
                <td>
                    <asp:Label ID="SectionLabel" runat="server" Text='<%# Eval("Section") %>' />
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr style="background-color:#FFF8DC;">
                <td>
                    <a href="<%#"ProductDetails.aspx?id="+ Eval("ID")%>" ><asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></a>
                </td>
                <td>
                    <asp:Label ID="AisleLabel" runat="server" Text='<%# Eval("Aisle") %>' />
                </td>
                <td>
                    <asp:Label ID="SectionLabel" runat="server" Text='<%# Eval("ID") %>' />
                </td>
            </tr>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No items in this category. </td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr style="">
                <td>
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                </td>
                <td>
                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                </td>
                <td>
                    <asp:TextBox ID="AisleTextBox" runat="server" Text='<%# Bind("Aisle") %>' />
                </td>
                <td>
                    <asp:TextBox ID="SectionTextBox" runat="server" Text='<%# Bind("Section") %>' />
                </td>
            </tr>
        </InsertItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                                <th runat="server">
                                    Name</th>
                                <th runat="server">
                                    Aisle</th>
                                <th runat="server">
                                    Section</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <EditItemTemplate>
            <tr style="background-color:#008A8C;color: #FFFFFF;">
                <td>
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                </td>
                <td>
                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                </td>
                <td>
                    <asp:TextBox ID="AisleTextBox" runat="server" Text='<%# Bind("Aisle") %>' />
                </td>
                <td>
                    <asp:TextBox ID="SectionTextBox" runat="server" Text='<%# Bind("Section") %>' />
                </td>
            </tr>
        </EditItemTemplate>
        <SelectedItemTemplate>
            <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                <td>
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                </td>
                <td>
                    <asp:Label ID="AisleLabel" runat="server" Text='<%# Eval("Aisle") %>' />
                </td>
                <td>
                    <asp:Label ID="SectionLabel" runat="server" Text='<%# Eval("Section") %>' />
                </td>
            </tr>
        </SelectedItemTemplate>
    </asp:ListView>

</asp:Content>

